<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Web" %>
<script language="C#" runat="server">
public IEnumerable<FileInfo> GetDumpFiles()
{
	List<FileInfo> files = new List<FileInfo>();
	foreach(string file in Directory.GetFiles(Server.MapPath("~/"), "*.zip"))
	{
		FileInfo fi = new FileInfo(file);
		string nameWithoutExtension = fi.Name.Replace(fi.Extension, "");
		if (!nameWithoutExtension.Contains("-"))
			continue;
		string[] revisionNumbers = nameWithoutExtension.Split('-');
		bool okToAddFile = true;
		foreach(string revisionNumber in revisionNumbers)
		{
			int rev;
			if (!Int32.TryParse(revisionNumber, out rev))
			{
				okToAddFile = false;
				break;
			}
		}
		if (okToAddFile)
			files.Add(fi);
	}
	return files;
}
</script>
<html>
	<head>
		<title>Awish SVN Weekly Dump Files</title>
		<style type="text/css">
		* { font-family:verdana; }
		table { border-collapse:collapse; }		
		td, th { text-align:left;padding-left:10px; }
		tr td { border-bottom:solid 1px silver; padding-top:5px;padding-bottom:5px; }
		tr th { color:white; background-color:#000088;}
		a { color:#00F; text-decoration:none; font-weight:bold;}
		a:hover { color:#FFF; background-color:#00F; }
		</style>
	</head>
	<body>
		<h2>Awish SVN Weekly Dump Files</h2>
		<table>
			<thead>
				<tr>
					<th width="150px">Dump File</th>
					<th width="300px">Date</th>
				</tr>
			</thead>
			<tbody>
				<% foreach(FileInfo file in GetDumpFiles()) { %>
				<tr>
					<td><a href="<%= VirtualPathUtility.ToAbsolute("~/" + file.Name) %>"><%= file.Name %></a></td>
					<td><%= file.CreationTime.ToString("MMM d, yyyy hh:mm ttt") %></td>
				</tr>
				<% } %>
			</tbody>
		</table>
	</body>
</html>